<%--
  Created by IntelliJ IDEA.
  User: gzheng
  Date: 17-11-21
  Time: 下午4:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>INSPINIA | Login</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.css" rel="stylesheet">

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
</head>
<body class="gray-bg">

<div class="middle-box text-center loginscreen animated fadeInDown">
    <div>
        <div>

            <h1 class="logo-name">IN+</h1>

        </div>
        <h3>Welcome to IN+</h3>
        <p>Perfectly designed and precisely prepared admin theme with over 50 pages with extra new web app views.
            <!--Continually expanded and constantly improved Inspinia Admin Them (IN+)-->
        </p>
        <p>Login in. To see it in action.</p>
        <form class="m-t" role="form" id="loginForm">
            <div class="form-group">
                <input type="text" name="userName" id="userName" class="form-control" placeholder="userName" required="">
            </div>
            <div class="form-group">
                <input type="password" name="password" id="password" class="form-control" placeholder="password" required="">
            </div>
            <button type="submit" class="btn btn-primary block full-width m-b">Login</button>

            <a href="#"><small>Forgot password?</small></a>
            <p class="text-muted text-center"><small>Do not have an account?</small></p>
            <a class="btn btn-sm btn-white btn-block" href="register.html">Create an account</a>
        </form>
        <p class="m-t"> <small>Inspinia we app framework base on Bootstrap 3 &copy; 2014</small> </p>
    </div>
</div>

<!-- Mainly scripts -->
<script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.form.js"></script>
<script src="js/md5.min.js"></script>

<script type="text/javascript">
    $(function () {


        $("#loginForm").ajaxForm({
            type: "post",
            url: "/userLogin",
            dataType: "json",
            beforeSubmit: function (param) {
              if(param!=null){

              }
                return true;
            },
            success: function (data) {
                if (data != null) {
                    var state = data.state;
                    if (state == 'suc'){
                        $(location).attr("href","/showUserList");
                    }else {
                        $(location).attr("href","/login");
                    }
                }

            }

        });
    });


</script>

</body>
</html>
